package com.ruoyi.zhhq.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zhhq.mapper.RepairMapper;
import com.ruoyi.zhhq.domain.Repair;
import com.ruoyi.zhhq.service.IRepairService;

/**
 * 维修Service业务层处理
 * 
 * @author Anthony Lu
 * @date 2022-10-31
 */
@Service
public class RepairServiceImpl implements IRepairService 
{
    @Autowired
    private RepairMapper repairMapper;

    /**
     * 查询维修
     * 
     * @param serviceId 维修主键
     * @return 维修
     */
    @Override
    public Repair selectRepairByServiceId(String serviceId)
    {
        return repairMapper.selectRepairByServiceId(serviceId);
    }
    
    
    /**
     * 查询维修列表
     * 
     * @return 维修集合
     */
    @Override
    public List<Repair> selectRepairListAll()
    {
    	return repairMapper.selectRepairListAll();
   
    }
    
    
    /**
     * 根据维修名称查询修理信息
     * @param serviceName 维修名称
     * @return 维修信息
     */
    public Repair selectRepairByServiceName(String serviceName)
    {
        return repairMapper.selectRepairByServiceName(serviceName);
    }
   
    /**
     * 查询维修列表
     * 
     * @param repair 维修
     * @return 维修
     */
    @Override
    public List<Repair> selectRepairList(Repair repair)
    {
        return repairMapper.selectRepairList(repair);
    }

    /**
     * 新增维修
     * 
     * @param repair 维修
     * @return 结果
     */
    @Override
    public int insertRepair(Repair repair)
    {
        repair.setCreateTime(DateUtils.getNowDate());
        return repairMapper.insertRepair(repair);
    }

    /**
     * 修改维修
     * 
     * @param repair 维修
     * @return 结果
     */
    @Override
    public int updateRepair(Repair repair)
    {
        repair.setUpdateTime(DateUtils.getNowDate());
        return repairMapper.updateRepair(repair);
    }

    /**
     * 批量删除维修
     * 
     * @param serviceIds 需要删除的维修主键
     * @return 结果
     */
    @Override
    public int deleteRepairByServiceIds(String[] serviceIds)
    {
        return repairMapper.deleteRepairByServiceIds(serviceIds);
    }

    /**
     * 删除维修信息
     * 
     * @param serviceId 维修主键
     * @return 结果
     */
    @Override
    public int deleteRepairByServiceId(String serviceId)
    {
        return repairMapper.deleteRepairByServiceId(serviceId);
    }
}
